package behavioral.iterator.custom;

import behavioral.iterator.MenuItem;

import java.util.List;

public class DrinksMenuIterator implements Iterator<MenuItem> {

    List<MenuItem> ls;
    int index = -1;

    public DrinksMenuIterator(List<MenuItem> ls) {
        this.ls = ls;
    }

    @Override
    public boolean hasNext() {
        return this.ls.size() > (index + 1);
    }

    @Override
    public MenuItem next() {
        index++;
        return this.ls.get(index);
    }
}
